#include <stdio.h>
#include <stdlib.h>

int *g_p = NULL;

void exit_fun( void )
{
    printf( "exit_fun running --- *g_p = %d\n", *g_p );
    free( g_p );
}


int main(int argc, char const *argv[])
{
    atexit( exit_fun );
 
    printf( "main running\n" );

    g_p = malloc( sizeof(int) );
    *g_p = 10;

   printf( "main end\n" );

   exit(222);
}
